Ext.ux.ViewCategory = Ext.extend(Ext.Window, {
	initComponent : function(config) {
		var linedata = Ext.getCmp("categoryDataGrid").getStore()
				.getAt(Ext.getCmp("categoryDataGrid").getSelectionModel().lastActive);
		
		var modifyForm = new Ext.FormPanel({
        	labelWidth : 100, // label settings here cascade unless overridden
			autoScroll:true,
			frame : true,
			region : 'center',
			border:true,
			fileUpload: true,
			bodyStyle : 'padding:5px 5px 0',
			width : '100%',
			defaults : {
				width : 220
			},
			defaultType : 'textfield',

			items : [{
				fieldLabel : '表述语言',
				id:'categoryLangView',
				editable:false
			},{
				fieldLabel : '类别名称',
				id:'categoryNameView',
				editable:false
			}, {
				fieldLabel : '类别归属',
				id:'categoryWhoView',
				editable:false
			}, {
				xtype:'textarea',
				fieldLabel : '类别简介',
				anchor:'95%',
				height:400,
				editable:false,
				enable:false,
				autoScroll:true,
				id:'categoryNotesView'
			}]
		});
		
		var jsonObject;
		Ext.Ajax.request( {
			url : basePath + 'base/loadCategory.action?category.id=' + linedata.json.id,
			method : 'post',
			callback : function(op, success, response) {
				var jsonObject = eval('(' + response.responseText + ')');
				Ext.getCmp("categoryNameView").setValue(jsonObject.name);
    			Ext.getCmp("categoryWhoView").setValue(jsonObject.whoCategory);
    			Ext.getCmp("categoryNotesView").setValue(jsonObject.notes);
    			Ext.getCmp("categoryLangView").setValue(jsonObject.lang);
			}
		});
		
		Ext.apply(this, {
			title: "查看类别信息",
	        plain: true,
	        width:1000,
	        height:600,
	        modal: true,
	        maximizable:true,
	        border: false,
	        layout: 'border',
	        autoScroll:true,
	        items: [modifyForm]
		});
		Ext.ux.ViewCategory.superclass.initComponent.apply(this, arguments);
	}
});
Ext.reg('lgnViewCategory', Ext.ux.ViewCategory);
